package 测试案例;
import java.util.*;
public class Test7 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int max = 0;
        int conut = 0;
        for(int i = 0; i < 32; i ++){
            if(((num >> i) & 1) == 1){
                conut ++;
            }else{
                max = max < conut ? conut : max;
                conut = 0;
            }

        }

        System.out.println(max);
    }
}
